package com.xbongbong.schedule.controller;

import com.google.inject.internal.cglib.core.$DebuggingClassWriter;
import com.xbongbong.schedule.domain.entity.ScheduleTaskEntity;
import com.xbongbong.schedule.enums.ScheduleTaskTypeEnum;
import com.xbongbong.schedule.pojo.dto.ScheduleTaskRabbitmqDTO;
import com.xbongbong.schedule.service.ScheduleTaskService;
import com.xbongbong.workflow.rabbitmq.constant.ScheduleTaskMqConsumerConstant;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 测试用controller
 * @author zheng.li
 **/
@RestController
public class TestController {

    @Resource
    private ScheduleTaskService scheduleTaskService;

    @RequestMapping(value = "pro/v1/schedule/task/test")
    String test(@RequestBody ScheduleTaskRabbitmqDTO scheduleTaskRabbitmqDTO) {
        ScheduleTaskEntity scheduleTaskEntity = new ScheduleTaskEntity();
        scheduleTaskEntity.setId(3L);
        scheduleTaskEntity.setName("test");
        scheduleTaskEntity.setAction("");
        scheduleTaskEntity.setCorpid("1");
        scheduleTaskEntity.setFormId(1L);
        scheduleTaskEntity.setTriggerTime(1668223025L);
        scheduleTaskEntity.setScheduleType(ScheduleTaskTypeEnum.SLA_LOG.getCode());
        scheduleTaskRabbitmqDTO.setScheduleTaskEntity(scheduleTaskEntity);
        scheduleTaskService.handleScheduleTask(scheduleTaskRabbitmqDTO);
        return "end";
    }


}
